// index.js
// 获取应用实例
const app = getApp()
var util = require('../../utils/util.js')

Page({
  data: {
    navBarHeight: app.globalData.navBarHeight,
    navTop: app.globalData.navTop,
    noticeText: '了解身边的一切，从天算开始。',
    newsList: [
      {
        id: 1,
        title: '天算系统，天算查询',
        imgUrl: 'https://t8.baidu.com/it/u=4193454865,3097077724&fm=3035&app=3035&size=f242,162&n=0&g=0n&f=JPEG?s=D58F0ABE4A6BDEC413019C84030030A9&sec=1683380394&t=ee726089378a3b5af688652849dc21c8'
      },
      {
        id: 2,
        title: '想长寿先养腿！教你5个腿不老的动作，越早做越好',
        imgUrl: 'https://t8.baidu.com/it/u=4193454865,3097077724&fm=3035&app=3035&size=f242,162&n=0&g=0n&f=JPEG?s=D58F0ABE4A6BDEC413019C84030030A9&sec=1683380394&t=ee726089378a3b5af688652849dc21c8'
      },
      {
        id: 3,
        title: '3天算系统，天算查询',
        imgUrl: 'https://t8.baidu.com/it/u=4193454865,3097077724&fm=3035&app=3035&size=f242,162&n=0&g=0n&f=JPEG?s=D58F0ABE4A6BDEC413019C84030030A9&sec=1683380394&t=ee726089378a3b5af688652849dc21c8'
      },
      {
        id: 4,
        title: '4天算系统，天算查询',
        imgUrl: 'https://t8.baidu.com/it/u=4193454865,3097077724&fm=3035&app=3035&size=f242,162&n=0&g=0n&f=JPEG?s=D58F0ABE4A6BDEC413019C84030030A9&sec=1683380394&t=ee726089378a3b5af688652849dc21c8'
      },
      {
        id: 5,
        title: '5天算系统，天算查询',
        imgUrl: 'https://t8.baidu.com/it/u=4193454865,3097077724&fm=3035&app=3035&size=f242,162&n=0&g=0n&f=JPEG?s=D58F0ABE4A6BDEC413019C84030030A9&sec=1683380394&t=ee726089378a3b5af688652849dc21c8'
      },
      {
        id: 6,
        title: '6天算系统，天算查询',
        imgUrl: 'https://t8.baidu.com/it/u=4193454865,3097077724&fm=3035&app=3035&size=f242,162&n=0&g=0n&f=JPEG?s=D58F0ABE4A6BDEC413019C84030030A9&sec=1683380394&t=ee726089378a3b5af688652849dc21c8'
      }
    ]
  },
  //跳转搜索
  goSearch(){
    wx.navigateTo({
      url: '../search/search',
    })
  },
  //跳转详情
  goInfo(e){
    let id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '../newslist/detail?id=' + id,
    })
  },
  //删除
  delNews(e){
    let id = e.currentTarget.dataset.id;
    let index = e.currentTarget.dataset.index;
    let newsList = this.data.newsList;
    // newsList.splice(id,1);
    newsList.splice(index,1);
    this.setData({
      newsList
    })
  },onReady(){
    
  },
  onLoad() {
    console.log('onload')
    // wx.request({
    //   url: 'https://www.baidu.com', //仅为示例，并非真实的接口地址
    //   method:"POST",
    //   header: {
    //     'content-type': 'application/json' // 默认值
    //   },
    //   success (res) {
    //     console.log('onload_end')
    //   }
     
    // })

 
  }
})
